﻿import friendfeed.api.data.Entry;
import friendfeed.api.FriendFeed;

public var _entry:Entry;

public function set entry(value:friendfeed.api.data.Entry):void
{
	var i:String;
	this._entry = value;
	this.nickname.text = value.user.name;
	this.published.text = value.published.toDateString();
	this.serviceName.text = value.service.name;
	this.userImage.source = value.user.getPictureUrl(FriendFeed.MEDIUM_SIZE);
	this.serviceImage.source = value.service.iconUrl;
	
	if (value.link)
		this.titleText.htmlText = '<a href="'+ value.link +'">'+ value.title +'</a>';
	else
		this.titleText.text = value.title;
	
	for (i in value.comments)
	{
		var cv:CommentView = new CommentView();
		this.comments.addChild(cv);
		cv.commentUser.source = value.comments[i].user.getPictureUrl();
		cv.commentName.text = value.comments[i].user.nickname;
		cv.commentBody.text = value.comments[i].body;
	}

	for (i in value.likes)
	{
		var lv:LikesView = new LikesView();
		this.likes.addChild(lv);
		lv.likesUser.source = value.likes[i].user.getPictureUrl();
		lv.likesName.text = value.likes[i].user.nickname;
	}
}